home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / latex209 / contrib / theapa / theapa.bst < prev    next >
Text File  |  1993-11-07  |  28KB  |  1,447 lines

  1.  
  2. %$$$ theapa.bst $$$ --- Version 2.5.1 (May 1992)
  3. %    by Young U. Ryu (young@emx.utexas.edu)
  4.  
  5. % copyright (C) 1991, 1992.
  6. %    Young U. Ryu
  7. % newapa.bst 2.0 - 1991.
  8. %    Young U. Ryu
  9. % newapa.bst - copyright (C) 1989, 1990.
  10. %    Stephen N. Spencer
  11. % apalike.bst - copyright (C) 1986, 1988.
  12. %    Susan King and Oren Patashnik
  13. % alpha.bst - copyright (C) 1985.
  14. %    Oren Patashnik
  15.  
  16. % Version 2.5 Update Notes (April 1992)
  17. %
  18. %    - \BUcase is dropped. It means that BibTeX always
  19. %      changes cases of article titles.
  20. %    - If you don't want to change cases of article titles,
  21. %      see comments following `FUNCTION {format.title}'.
  22. %    - See update notes in `theapa.sty'.
  23.  
  24. % Version 2.4 Update Notes (April 1992)
  25. %
  26. %    - See update notes in `theapa.sty'.
  27.  
  28. % Version 2.3 Update Notes (March 1992)
  29. %    - See update notes in `theapa.sty'.
  30.  
  31. % Version 2.2 Update Notes (March 1992)
  32. %
  33. %    - A bug reported by Richard Dallaway <richardd@cogs.sussex.ac.uk>:
  34. %
  35. %             two periods after the title of MISC entries
  36. %             (also two periods after the title of BOOKLET entries)
  37. %
  38. %      is fixed by adding a function {output.atitle} and modifying
  39. %      functions {booklet} and {misc}.
  40. %    - A bug reported by someone (Sorry, I lost his/her E-mail.):
  41. %
  42. %             incorrect order of references, e.x.
  43. %               Bond K. \&\ Scott L.
  44. %               Bond P. \&\ Scott L.
  45. %               Bond K. \&\ Wright O. % This line must come before the above
  46. %
  47. %      is fixed by switching first two lines of the function {presort}.
  48. %    - The function {unpublished} is changed to avoid potential errors.
  49.  
  50. % Version 2.1 Update Notes
  51. %    - See update notes in `theapa.sty'.
  52.  
  53. % Tutorial Notes
  54. %    - See tutorial notes in `theapa.sty'.
  55.  
  56. % Copying of this file is authorized only if either
  57. % (1) you make absolutely no changes to your copy, including names, or
  58. % (2) if you do make changes, you name it something other than
  59. % btxbst.doc, plain.bst, unsrt.bst, alpha.bst, and abbrv.bst.
  60. % This restriction helps ensure that all standard styles are identical.
  61.  
  62. % Requirements: BibTeX 0.99a (or higher?),
  63. %               theapa.sty 2.4 under LaTeX 2.09 (or higher?)
  64. %
  65. %  NO GUARANTEE, absolutely (You know what I mean.)!!!
  66.  
  67. ENTRY
  68.   { address
  69.     author
  70.     booktitle
  71.     chapter
  72.     edition
  73.     editor
  74.     howpublished
  75.     institution
  76.     journal
  77.     key
  78.     month
  79.     note
  80.     number
  81.     organization
  82.     pages
  83.     publisher
  84.     school
  85.     series
  86.     title
  87.     type
  88.     volume
  89.     year
  90.   }
  91.   {}
  92.   { label extra.label sort.label }
  93.  
  94. INTEGERS { output.state before.all mid.sentence after.sentence after.block }
  95.  
  96. FUNCTION {init.state.consts}
  97. { #0 'before.all :=
  98.   #1 'mid.sentence :=
  99.   #2 'after.sentence :=
  100.   #3 'after.block :=
  101. }
  102.  
  103. STRINGS { s t }
  104.  
  105. FUNCTION {output.nonnull}
  106. { 's :=
  107.   output.state mid.sentence =
  108.     { ", " * write$ }
  109.     { output.state after.block =
  110.         { add.period$ write$
  111.           newline$
  112.           "\newblock " write$
  113.         }
  114.         { output.state before.all =
  115.             'write$
  116.             { add.period$ " " * write$ }
  117.           if$
  118.         }
  119.       if$
  120.       mid.sentence 'output.state :=
  121.     }
  122.   if$
  123.   s
  124. }
  125.  
  126. FUNCTION {output.atitle.nonnull}
  127. { 's :=
  128.   output.state mid.sentence =
  129.     { "\ " * write$ }
  130.     { output.state after.block =
  131.         { "\ " * write$
  132.           newline$
  133.           "\newblock " write$
  134.         }
  135.         { output.state before.all =
  136.             'write$
  137.             { "\ " * write$ }
  138.           if$
  139.         }
  140.       if$
  141.       mid.sentence 'output.state :=
  142.     }
  143.   if$
  144.   s
  145. }
  146.  
  147. FUNCTION {output}
  148. { duplicate$ empty$
  149.     'pop$
  150.     'output.nonnull
  151.   if$
  152. }
  153.  
  154. FUNCTION {output.atitle}
  155. { duplicate$ empty$
  156.     'pop$
  157.     'output.atitle.nonnull
  158.   if$
  159. }
  160.  
  161. FUNCTION {output.check}
  162. { 't :=
  163.   duplicate$ empty$
  164.     { pop$ "empty " t * " in " * cite$ * warning$ }
  165.     'output.nonnull
  166.   if$
  167. }
  168.  
  169. FUNCTION {output.atitle.check}
  170. { 't :=
  171.   duplicate$ empty$
  172.     { pop$ "empty " t * " in " * cite$ * warning$ }
  173.     'output.atitle.nonnull
  174.   if$
  175. }
  176.  
  177. FUNCTION {output.year.check}
  178. { year empty$
  179.      { "empty year in " cite$ * warning$ }
  180.      { write$
  181.         " \BBOP" year * extra.label * "\BBCP" *
  182.         mid.sentence 'output.state :=
  183.      }
  184.   if$
  185. }
  186.  
  187. FUNCTION {output.bibitem}
  188. { newline$
  189.   "\bibitem[" write$
  190.   label write$
  191.   "]{" write$
  192.   cite$ write$
  193.   "}" write$
  194.   newline$
  195.   ""
  196.   before.all 'output.state :=
  197. }
  198.  
  199. FUNCTION {fin.entry}
  200. { add.period$
  201.   write$
  202.   newline$
  203. }
  204.  
  205. FUNCTION {new.block}
  206. { output.state before.all =
  207.     'skip$
  208.     { after.block 'output.state := }
  209.   if$
  210. }
  211.  
  212. FUNCTION {new.sentence}
  213. { output.state after.block =
  214.     'skip$
  215.     { output.state before.all =
  216.         'skip$
  217.         { after.sentence 'output.state := }
  218.       if$
  219.     }
  220.   if$
  221. }
  222.  
  223. FUNCTION {not}
  224. {   { #0 }
  225.     { #1 }
  226.   if$
  227. }
  228.  
  229. FUNCTION {and}
  230. {   'skip$
  231.     { pop$ #0 }
  232.   if$
  233. }
  234.  
  235. FUNCTION {or}
  236. {   { pop$ #1 }
  237.     'skip$
  238.   if$
  239. }
  240.  
  241. FUNCTION {new.block.checka}
  242. { empty$
  243.     'skip$
  244.     'new.block
  245.   if$
  246. }
  247.  
  248. FUNCTION {new.block.checkb}
  249. { empty$
  250.   swap$ empty$
  251.   and
  252.     'skip$
  253.     'new.block
  254.   if$
  255. }
  256.  
  257. FUNCTION {new.sentence.checka}
  258. { empty$
  259.     'skip$
  260.     'new.sentence
  261.   if$
  262. }
  263.  
  264. FUNCTION {new.sentence.checkb}
  265. { empty$
  266.   swap$ empty$
  267.   and
  268.     'skip$
  269.     'new.sentence
  270.   if$
  271. }
  272.  
  273. FUNCTION {field.or.null}
  274. { duplicate$ empty$
  275.     { pop$ "" }
  276.     'skip$
  277.   if$
  278. }
  279.  
  280. FUNCTION {emphasize}
  281. { duplicate$ empty$
  282.     { pop$ "" }
  283.     { "{\Bem " swap$ * "}" * }
  284.   if$
  285. }
  286.  
  287. FUNCTION {emphasize.space}
  288. { duplicate$ empty$
  289.     { pop$ "" }
  290.     { "{\Bem " swap$ * "\/}" * }
  291.   if$
  292. }
  293.  
  294. INTEGERS { nameptr namesleft numnames }
  295.  
  296. FUNCTION {format.names}
  297. { 's :=
  298.   #1 'nameptr :=
  299.   s num.names$ 'numnames :=
  300.   numnames 'namesleft :=
  301.     { namesleft #0 > }
  302.     { s nameptr "{vv~}{ll}{, jj}{, F.}" format.name$ 't :=
  303.       nameptr #1 >
  304.         { namesleft #1 >
  305.             { ", " * t * }
  306.         { numnames #2 >
  307.                 { "," * }
  308.         { "\BBACOMMA\ " * }
  309.               if$
  310.               t "others" =
  311.                 { " et~al." * }
  312.                 { " \BBA\ " * t * }
  313.               if$
  314.             }
  315.           if$
  316.         }
  317.         't
  318.       if$
  319.       nameptr #1 + 'nameptr :=
  320.       namesleft #1 - 'namesleft :=
  321.     }
  322.   while$
  323. }
  324.  
  325. FUNCTION {format.authors}
  326. { author empty$
  327.     { "" }
  328.     { author format.names }
  329.   if$
  330. }
  331.  
  332. FUNCTION {format.editors}
  333. { editor empty$
  334.     { "" }
  335.     { editor format.names
  336.       editor num.names$ #1 >
  337.         { "\BEDS" * }
  338.         { "\BED" * }
  339.       if$
  340.     }
  341.   if$
  342. }
  343.  
  344. FUNCTION {format.editors.dot}
  345. { editor empty$
  346.     { "" }
  347.     { editor format.names
  348.       editor num.names$ #1 >
  349.     { "\BEDS." * }
  350.     { "\BED." * }
  351.       if$
  352.     }
  353.   if$
  354. }
  355.  
  356. FUNCTION {format.key}
  357. { empty$
  358.     { key field.or.null }
  359.     { "" }
  360.   if$
  361. }
  362.  
  363. %FUNCTION {format.title}
  364. %{ title empty$
  365. %    { "" }
  366. %    { "\BBOQ " title "t" change.case$ * "\BBCQ" *}
  367. %  if$
  368. %}
  369.  
  370. % If you don't want to change cases of article titles,
  371. % use the following `format.title' function instead the one.
  372.  
  373. FUNCTION {format.title}
  374. { title empty$
  375.     { "" }
  376.     { "\BBOQ " title * "\BBCQ" *}
  377.   if$
  378. }
  379.  
  380. FUNCTION {n.dashify}
  381. { 't :=
  382.   ""
  383.     { t empty$ not }
  384.     { t #1 #1 substring$ "-" =
  385.         { t #1 #2 substring$ "--" = not
  386.             { "--" *
  387.               t #2 global.max$ substring$ 't :=
  388.             }
  389.             {   { t #1 #1 substring$ "-" = }
  390.                 { "-" *
  391.                   t #2 global.max$ substring$ 't :=
  392.                 }
  393.               while$
  394.             }
  395.           if$
  396.         }
  397.         { t #1 #1 substring$ *
  398.           t #2 global.max$ substring$ 't :=
  399.         }
  400.       if$
  401.     }
  402.   while$
  403. }
  404.  
  405. FUNCTION {format.btitle}
  406. { edition empty$
  407.   { title emphasize }
  408.   { title empty$
  409.     { title emphasize }
  410.     { "{\Bem " title * "\/} (" * edition * " \BEd)" * "." * }
  411.     if$
  412.   }
  413.   if$
  414. }
  415.  
  416. FUNCTION {format.emphasize.booktitle}
  417. { edition empty$
  418.   { booktitle emphasize }
  419.   { booktitle empty$
  420.     { booktitle emphasize }
  421.     { "{\Bem " booktitle * "\/} (" * edition * " \BEd)" * "." * }
  422.     if$
  423.   }
  424.   if$
  425. }
  426.  
  427. FUNCTION {tie.or.space.connect}
  428. { duplicate$ text.length$ #3 <
  429.     { "~" }
  430.     { "\ " }
  431.   if$
  432.   swap$ * *
  433. }
  434.  
  435. FUNCTION {either.or.check}
  436. { empty$
  437.     'pop$
  438.     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  439.   if$
  440. }
  441.  
  442. FUNCTION {format.bvolume}
  443. { volume empty$
  444.     { "" }
  445.     { "\lowercase{\BVOL}" volume tie.or.space.connect
  446.       series empty$
  447.         'skip$
  448.         { " of " * series emphasize * }
  449.       if$
  450.       "\losercase{\BVOL\ and \BNUM}" number either.or.check
  451.     }
  452.   if$
  453. }
  454.  
  455. FUNCTION {format.number.series}
  456. { volume empty$
  457.     { number empty$
  458.         { series field.or.null }
  459.         { output.state mid.sentence =
  460.             { "\lowercase{\BNUM}" }
  461.             { "\BNUM" }
  462.           if$
  463.           number tie.or.space.connect
  464.           series empty$
  465.             { "there's a number but no series in " cite$ * warning$ }
  466.             { " in " * series * }
  467.           if$
  468.         }
  469.       if$
  470.     }
  471.     { "" }
  472.   if$
  473. }
  474.  
  475. FUNCTION {format.edition}
  476. { edition empty$
  477.     { "" }
  478.     { output.state mid.sentence =
  479.         { edition "l" change.case$ " \BEd" * }
  480.         { edition "t" change.case$ " \BEd" * }
  481.       if$
  482.     }
  483.   if$
  484. }
  485.  
  486. INTEGERS { multiresult }
  487.  
  488. FUNCTION {multi.page.check}
  489. { 't :=
  490.   #0 'multiresult :=
  491.     { multiresult not
  492.       t empty$ not
  493.       and
  494.     }
  495.     { t #1 #1 substring$
  496.       duplicate$ "-" =
  497.       swap$ duplicate$ "," =
  498.       swap$ "+" =
  499.       or or
  500.         { #1 'multiresult := }
  501.         { t #2 global.max$ substring$ 't := }
  502.       if$
  503.     }
  504.   while$
  505.   multiresult
  506. }
  507.  
  508. FUNCTION {format.pages}
  509. { pages empty$
  510.     { "" }
  511.     { pages multi.page.check
  512.         { "\BPGS" pages n.dashify tie.or.space.connect }
  513.         { "\BPG" pages tie.or.space.connect }
  514.       if$
  515.     }
  516.   if$
  517. }
  518.  
  519. FUNCTION {format.vol.num.pages}
  520. { number empty$
  521.     { volume empty$
  522.        'skip$
  523.        { "{\Bem " volume * "}" * }
  524.       if$
  525.     }
  526.     { volume emphasize.space
  527.       volume empty$
  528.        {"there's a number but no volume in " cite$ * warning$ }
  529.        { "(" number * ")" * * }
  530.       if$
  531.     }
  532.   if$
  533.   pages empty$
  534.     'skip$
  535.     { duplicate$ empty$
  536.       { pop$ format.pages }
  537.       { ", " * pages n.dashify * }
  538.       if$
  539.     }
  540.   if$
  541. }
  542.  
  543. FUNCTION {format.chapter.pages}
  544. { chapter empty$
  545.     'format.pages
  546.     { type empty$
  547.         { "\BCH" }
  548.         { type "l" change.case$ }
  549.       if$
  550.       chapter tie.or.space.connect
  551.       pages empty$
  552.         'skip$
  553.         { ", " * format.pages * }
  554.       if$
  555.     }
  556.   if$
  557. }
  558.  
  559. FUNCTION {format.in.ed.booktitle}
  560. { booktitle empty$
  561.     { "" }
  562.     { editor empty$
  563.         { "In " format.emphasize.booktitle * }                            
  564.         { "In " format.editors * ", " * format.emphasize.booktitle * }    
  565.       if$
  566.     }
  567.   if$
  568. }
  569.  
  570. FUNCTION {empty.misc.check}
  571. { author empty$ title empty$ howpublished empty$
  572.   month empty$ year empty$ note empty$
  573.   and and and and and
  574.   key empty$ not and
  575.     { "all relevant fields are empty in " cite$ * warning$ }
  576.     'skip$
  577.   if$
  578. }
  579.  
  580. FUNCTION {format.thesis.type}
  581. { type empty$
  582.     'skip$
  583.     { pop$
  584.       type "t" change.case$
  585.     }
  586.   if$
  587. }
  588.  
  589. FUNCTION {format.tr.number}
  590. { type empty$
  591.     { "\BTR" }
  592.     { type "t" change.case$ }
  593.   if$
  594.   number empty$
  595.     'skip$
  596.     { number tie.or.space.connect }
  597.   if$
  598. }
  599.  
  600.  
  601. FUNCTION {format.article.crossref}
  602. { key empty$
  603.     { journal empty$
  604.         { "need key or journal for " cite$ * " to crossref " * crossref *
  605.           warning$
  606.           ""
  607.         }
  608.         { "In {\Bem " journal * "\/}" * }
  609.       if$
  610.     }
  611.     { "In " key * }
  612.   if$
  613.   " \citeyear{" * crossref * "}" *
  614. }
  615.  
  616. FUNCTION {format.crossref.editor}
  617. { editor #1 "{vv~}{ll}" format.name$
  618.   editor num.names$ duplicate$
  619.   #2 >
  620.     { pop$ " et~al." * }
  621.     { #2 <
  622.         'skip$
  623.         { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  624.             { " et~al." * }
  625.             { "\BBACOMMA\ \BBA\ " * editor #2 "{vv~}{ll}" format.name$ * }
  626.           if$
  627.         }
  628.       if$
  629.     }
  630.   if$
  631. }
  632.  
  633. FUNCTION {format.book.crossref}
  634. { volume empty$
  635.     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
  636.       "In "
  637.     }
  638.     { "\BVOL" volume tie.or.space.connect
  639.       " of " *
  640.     }
  641.   if$
  642.   editor empty$
  643.   editor field.or.null author field.or.null =
  644.   or
  645.     { key empty$
  646.         { series empty$
  647.             { "need editor, key, or series for " cite$ * " to crossref " *
  648.               crossref * warning$
  649.               "" *
  650.             }
  651.             { "{\Bem " * series * "\/}" * }
  652.           if$
  653.         }
  654.         { key * }
  655.       if$
  656.     }
  657.     { format.crossref.editor * }
  658.   if$
  659.   " \citeyear{" * crossref * "}" *
  660. }
  661.  
  662. FUNCTION {format.incoll.inproc.crossref}
  663. { editor empty$
  664.   editor field.or.null author field.or.null =
  665.   or
  666.     { key empty$
  667.         { booktitle empty$
  668.             { "need editor, key, or booktitle for " cite$ * " to crossref " *
  669.               crossref * warning$
  670.               ""
  671.             }
  672.             { "In {\Bem " booktitle * "\/}" * }
  673.           if$
  674.         }
  675.         { "In " key * }
  676.       if$
  677.     }
  678.     { "In " format.crossref.editor * }
  679.   if$
  680.   " \citeyear{" * crossref * "}" *
  681. }
  682.  
  683. FUNCTION {article}
  684. { output.bibitem
  685.   format.authors "author" output.check
  686.   author format.key output
  687.   output.year.check
  688.   new.block
  689.   format.title "title" output.check
  690.   new.block
  691.   crossref missing$
  692.     { journal emphasize "journal" output.atitle.check
  693.       format.vol.num.pages output
  694.     }
  695.     { format.article.crossref output.atitle.nonnull
  696.       format.pages output
  697.     }
  698.   if$
  699.   new.block
  700.   note output
  701.   fin.entry
  702. }
  703.  
  704. FUNCTION {book}
  705. { output.bibitem
  706.   author empty$
  707.     { format.editors.dot "author and editor" output.check }
  708.     { format.authors output.nonnull
  709.       crossref missing$
  710.         { "author and editor" editor either.or.check }
  711.         'skip$
  712.       if$
  713.     }
  714.   if$
  715.   output.year.check
  716.   new.block
  717.   format.btitle "title" output.check
  718.   crossref missing$
  719.     { format.bvolume output
  720.       new.block
  721.       format.number.series output
  722.       new.sentence
  723.       publisher "publisher" output.check
  724.       address output
  725.     }
  726.     { new.block
  727.       format.book.crossref output.nonnull
  728.     }
  729.   if$
  730.   new.block
  731.   note output
  732.   fin.entry
  733. }
  734.  
  735. FUNCTION {booklet}
  736. { output.bibitem
  737.   format.authors output
  738.   author format.key output
  739.   output.year.check
  740.   new.block
  741.   format.btitle "title" output.check
  742.   howpublished address new.block.checkb
  743.   howpublished output
  744.   address output
  745.   new.block
  746.   note output
  747.   fin.entry
  748. }
  749.  
  750. FUNCTION {inbook}
  751. { output.bibitem
  752.   author empty$
  753.     { format.editors.dot "author and editor" output.check }
  754.     { format.authors output.nonnull
  755.       crossref missing$
  756.         { "author and editor" editor either.or.check }
  757.         'skip$
  758.       if$
  759.     }
  760.   if$
  761.   output.year.check
  762.   new.block
  763.   format.btitle "title" output.check
  764.   crossref missing$
  765.     { format.bvolume output
  766.       format.chapter.pages "chapter and pages" output.check
  767.       new.block
  768.       format.number.series output
  769.       new.sentence
  770.       publisher "publisher" output.check
  771.       address output
  772.     }
  773.     { format.chapter.pages "chapter and pages" output.check
  774.       new.block
  775.       format.book.crossref output.nonnull
  776.     }
  777.   if$
  778.   new.block
  779.   note output
  780.   fin.entry
  781. }
  782.  
  783. FUNCTION {incollection}
  784. { output.bibitem
  785.   format.authors "author" output.check
  786.   author format.key output
  787.   output.year.check
  788.   new.block
  789.   format.title "title" output.check
  790.   new.block
  791.   crossref missing$
  792.     { format.in.ed.booktitle "booktitle" output.atitle.check
  793.       format.bvolume output
  794.       format.number.series output
  795.       format.chapter.pages output
  796.       new.sentence
  797.       publisher "publisher" output.check
  798.       address output
  799.     }
  800.     { format.incoll.inproc.crossref output.atitle.nonnull
  801.       format.chapter.pages output
  802.     }
  803.   if$
  804.   new.block
  805.   note output
  806.   fin.entry
  807. }
  808.  
  809. FUNCTION {inproceedings}
  810. { output.bibitem
  811.   format.authors "author" output.check
  812.   author format.key output
  813.   output.year.check
  814.   new.block
  815.   format.title "title" output.check
  816.   new.block
  817.   crossref missing$
  818.     { format.in.ed.booktitle "booktitle" output.atitle.check
  819.       format.bvolume output
  820.       format.number.series output
  821.       format.pages output
  822.       address empty$
  823.         { organization publisher new.sentence.checkb
  824.           organization output
  825.           publisher output
  826.         }
  827.         { address output.atitle.nonnull
  828.           new.sentence
  829.           organization output
  830.           publisher output
  831.         }
  832.       if$
  833.     }
  834.     { format.incoll.inproc.crossref output.nonnull
  835.       format.pages output
  836.     }
  837.   if$
  838.   new.block
  839.   note output
  840.   fin.entry
  841. }
  842.  
  843. FUNCTION {conference} { inproceedings }
  844.  
  845. FUNCTION {manual}
  846. { output.bibitem
  847.   author empty$
  848.     { organization empty$
  849.         'skip$
  850.         { organization output.nonnull
  851.           address output
  852.         }
  853.       if$
  854.     }
  855.     { format.authors output.nonnull }
  856.   if$
  857.   output.year.check
  858.   new.block
  859.   format.btitle "title" output.check
  860.   author empty$
  861.     { organization empty$
  862.         { address new.block.checka
  863.           address output
  864.         }
  865.         'skip$
  866.       if$
  867.     }
  868.     { organization address new.block.checkb
  869.       organization output
  870.       address output
  871.     }
  872.   if$
  873.   new.block
  874.   note output
  875.   fin.entry
  876. }
  877.  
  878. FUNCTION {mastersthesis}
  879. { output.bibitem
  880.   format.authors "author" output.check
  881.   author format.key output
  882.   output.year.check
  883.   new.block
  884.   format.title "title" output.check
  885.   new.block
  886.   "Master's thesis" format.thesis.type output.atitle.nonnull
  887.   school "school" output.check
  888.   address output
  889.   new.block
  890.   note output
  891.   fin.entry
  892. }
  893.  
  894. FUNCTION {mastersreport}
  895. { output.bibitem
  896.   format.authors "author" output.check
  897.   author format.key output
  898.   output.year.check
  899.   new.block
  900.   format.title "title" output.check
  901.   new.block
  902.   "Master's report" format.thesis.type output.atitle.nonnull
  903.   school "school" output.check
  904.   address output
  905.   new.block
  906.   note output
  907.   fin.entry
  908. }
  909.  
  910. FUNCTION {misc}
  911. { output.bibitem
  912.   format.authors output
  913.   author format.key output
  914.   output.year.check
  915.   title howpublished new.block.checkb
  916.   format.title "title" output.check
  917.   howpublished new.block.checka
  918.   howpublished output.atitle
  919.   new.block
  920.   note output
  921.   fin.entry
  922.   empty.misc.check
  923. }
  924.  
  925. FUNCTION {phdthesis}
  926. { output.bibitem
  927.   format.authors "author" output.check
  928.   author format.key output
  929.   output.year.check
  930.   new.block
  931.   format.btitle "title" output.check
  932.   new.block
  933.   "Ph.D.\ thesis" format.thesis.type output.nonnull
  934.   school "school" output.check
  935.   address output
  936.   new.block
  937.   note output
  938.   fin.entry
  939. }
  940.  
  941. FUNCTION {dbathesis}
  942. { output.bibitem
  943.   format.authors "author" output.check
  944.   author format.key output
  945.   output.year.check
  946.   new.block
  947.   format.btitle "title" output.check
  948.   new.block
  949.   "DBA thesis" format.thesis.type output.nonnull
  950.   school "school" output.check
  951.   address output
  952.   new.block
  953.   note output
  954.   fin.entry
  955. }
  956.  
  957. FUNCTION {eddthesis}
  958. { output.bibitem
  959.   format.authors "author" output.check
  960.   author format.key output
  961.   output.year.check
  962.   new.block
  963.   format.btitle "title" output.check
  964.   new.block
  965.   "Ed.D.\ thesis" format.thesis.type output.nonnull
  966.   school "school" output.check
  967.   address output
  968.   new.block
  969.   note output
  970.   fin.entry
  971. }
  972.  
  973. FUNCTION {proceedings}
  974. { output.bibitem
  975.   editor empty$
  976.     { organization output }
  977.     { format.editors.dot output.nonnull }
  978.   if$
  979.   author format.key output
  980.   output.year.check
  981.   new.block
  982.   format.btitle "title" output.check
  983.   format.bvolume output
  984.   format.number.series output
  985.   address empty$
  986.     { editor empty$
  987.         { publisher new.sentence.checka }
  988.         { organization publisher new.sentence.checkb
  989.           organization output
  990.         }
  991.       if$
  992.       publisher output
  993.     }
  994.     { address output.nonnull
  995.       new.sentence
  996.       editor empty$
  997.         'skip$
  998.         { organization output }
  999.       if$
  1000.       publisher output
  1001.     }
  1002.   if$
  1003.   new.block
  1004.   note output
  1005.   fin.entry
  1006. }
  1007.  
  1008. FUNCTION {techreport}
  1009. { output.bibitem
  1010.   format.authors "author" output.check
  1011.   author format.key output
  1012.   output.year.check
  1013.   new.block
  1014.   format.title "title" output.check
  1015.   new.block
  1016.   format.tr.number output.atitle.nonnull
  1017.   institution "institution" output.check
  1018.   address output
  1019.   new.block
  1020.   note output
  1021.   fin.entry
  1022. }
  1023.  
  1024. FUNCTION {unpublished}
  1025. { output.bibitem
  1026.   format.authors "author" output.check
  1027.   author format.key output
  1028.   output.year.check
  1029.   new.block
  1030.   format.title "title" output.check
  1031.   new.block
  1032.   note output.atitle
  1033.   fin.entry
  1034. }
  1035.  
  1036. FUNCTION {default.type} { misc }
  1037.  
  1038. MACRO {jan} {"January"}
  1039.  
  1040. MACRO {feb} {"February"}
  1041.  
  1042. MACRO {mar} {"March"}
  1043.  
  1044. MACRO {apr} {"April"}
  1045.  
  1046. MACRO {may} {"May"}
  1047.  
  1048. MACRO {jun} {"June"}
  1049.  
  1050. MACRO {jul} {"July"}
  1051.  
  1052. MACRO {aug} {"August"}
  1053.  
  1054. MACRO {sep} {"September"}
  1055.  
  1056. MACRO {oct} {"October"}
  1057.  
  1058. MACRO {nov} {"November"}
  1059.  
  1060. MACRO {dec} {"December"}
  1061.  
  1062. MACRO {acmcs} {"ACM Computing Surveys"}
  1063.  
  1064. MACRO {acta} {"Acta Informatica"}
  1065.  
  1066. MACRO {cacm} {"Communications of the ACM"}
  1067.  
  1068. MACRO {ibmjrd} {"IBM Journal of Research and Development"}
  1069.  
  1070. MACRO {ibmsj} {"IBM Systems Journal"}
  1071.  
  1072. MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
  1073.  
  1074. MACRO {ieeetc} {"IEEE Transactions on Computers"}
  1075.  
  1076. MACRO {ieeetcad}
  1077.  {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
  1078.  
  1079. MACRO {ipl} {"Information Processing Letters"}
  1080.  
  1081. MACRO {jacm} {"Journal of the ACM"}
  1082.  
  1083. MACRO {jcss} {"Journal of Computer and System Sciences"}
  1084.  
  1085. MACRO {scp} {"Science of Computer Programming"}
  1086.  
  1087. MACRO {sicomp} {"SIAM Journal on Computing"}
  1088.  
  1089. MACRO {tocs} {"ACM Transactions on Computer Systems"}
  1090.  
  1091. MACRO {tods} {"ACM Transactions on Database Systems"}
  1092.  
  1093. MACRO {tog} {"ACM Transactions on Graphics"}
  1094.  
  1095. MACRO {toms} {"ACM Transactions on Mathematical Software"}
  1096.  
  1097. MACRO {toois} {"ACM Transactions on Office Information Systems"}
  1098.  
  1099. MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
  1100.  
  1101. MACRO {tcs} {"Theoretical Computer Science"}
  1102.  
  1103. READ
  1104.  
  1105. FUNCTION {sortify}
  1106. { purify$
  1107.   "l" change.case$
  1108. }
  1109.  
  1110. INTEGERS { len }
  1111.  
  1112. FUNCTION {chop.word}
  1113. { 's :=
  1114.   'len :=
  1115.   s #1 len substring$ =
  1116.     { s len #1 + global.max$ substring$ }
  1117.     's
  1118.   if$
  1119. }
  1120.  
  1121. INTEGERS { et.al.char.used }
  1122.  
  1123. FUNCTION {initialize.et.al.char.used}
  1124. { #0 'et.al.char.used :=
  1125. }
  1126.  
  1127. EXECUTE {initialize.et.al.char.used}
  1128.  
  1129. FUNCTION {format.full.lab.names}
  1130. { 's :=
  1131.   #1 'nameptr :=
  1132.   s num.names$ 'numnames :=
  1133.   numnames 'namesleft :=
  1134.     { namesleft #0 > }
  1135.     { s nameptr "{vv~}{ll}" format.name$ 't :=
  1136.       nameptr #1 >
  1137.         { namesleft #1 >
  1138.             { ", " * t * }
  1139.             { numnames #2 >
  1140.                 { "," * }
  1141.                 'skip$
  1142.               if$
  1143.               t "others" =
  1144.                 { " et~al." * }
  1145.                 { " \BBA\ " * t * }
  1146.               if$
  1147.             }
  1148.           if$
  1149.         }
  1150.         't
  1151.       if$
  1152.       nameptr #1 + 'nameptr :=
  1153.       namesleft #1 - 'namesleft :=
  1154.     }
  1155.   while$
  1156. }
  1157.  
  1158. FUNCTION {format.lab.names}
  1159. { 's :=                             
  1160.   s #1 "{vv~}{ll}" format.name$        
  1161.   s num.names$ duplicate$
  1162.   #2 >                                
  1163.      { pop$ " et~al." * }            
  1164.      { #2 <
  1165.           'skip$
  1166.           { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  1167.                 { " et~al." * }
  1168.                 { " \BBA\ " * s #2 "{vv~}{ll}" format.name$ * }
  1169.              if$
  1170.           }
  1171.        if$
  1172.      }
  1173.   if$
  1174. }
  1175.  
  1176. FUNCTION {author.key.label}
  1177. { author empty$
  1178.     { key empty$
  1179.         { cite$ #1 #3 substring$ }
  1180.         { key #3 text.prefix$ }
  1181.       if$
  1182.     }
  1183.     { author format.lab.names }
  1184.   if$
  1185. }
  1186.  
  1187. FUNCTION {author.editor.key.label}
  1188. { author empty$
  1189.     { editor empty$
  1190.         { key empty$
  1191.             { cite$ #1 #3 substring$ }
  1192.             { key #3 text.prefix$ }
  1193.           if$
  1194.         }
  1195.         { editor format.lab.names }
  1196.       if$
  1197.     }
  1198.     { author format.lab.names }
  1199.   if$
  1200. }
  1201.  
  1202. FUNCTION {author.key.organization.label}
  1203. { author empty$
  1204.     { key empty$
  1205.         { organization empty$
  1206.             { cite$ #1 #3 substring$ }
  1207.             { "The " #4 organization chop.word #3 text.prefix$ }
  1208.           if$
  1209.         }
  1210.         { key #3 text.prefix$ }
  1211.       if$
  1212.     }
  1213.     { author format.lab.names }
  1214.   if$
  1215. }
  1216.  
  1217. FUNCTION {editor.key.organization.label}
  1218. { editor empty$
  1219.     { key empty$
  1220.         { organization empty$
  1221.             { cite$ #1 #3 substring$ }
  1222.             { "The " #4 organization chop.word #3 text.prefix$ }
  1223.           if$
  1224.         }
  1225.         { key #3 text.prefix$ }
  1226.       if$
  1227.     }
  1228.     { editor format.lab.names }
  1229.   if$
  1230. }
  1231.  
  1232. FUNCTION {calc.label}
  1233. { type$ "book" =
  1234.   type$ "inbook" =
  1235.   or
  1236.     'author.editor.key.label
  1237.     { type$ "proceedings" =
  1238.         'editor.key.organization.label
  1239.         { type$ "manual" =
  1240.             'author.key.organization.label
  1241.             'author.key.label
  1242.           if$
  1243.         }
  1244.       if$
  1245.     }
  1246.   if$
  1247.   duplicate$
  1248.  
  1249.   author empty$
  1250.     { editor format.full.lab.names }
  1251.     { author format.full.lab.names }
  1252.   if$
  1253.   "\protect\BCAY{" swap$ * "}{" * swap$ * "}{" *
  1254.   year field.or.null purify$ #-1 #4 substring$ *
  1255.   'label :=
  1256.   year field.or.null purify$ #-1 #4 substring$ *
  1257.   sortify 'sort.label :=
  1258. }
  1259.  
  1260. FUNCTION {sort.format.names}
  1261. { 's :=
  1262.   #1 'nameptr :=
  1263.   ""
  1264.   s num.names$ 'numnames :=
  1265.   numnames 'namesleft :=
  1266.     { namesleft #0 > }
  1267.     { nameptr #1 >
  1268.         { "   " * }
  1269.         'skip$
  1270.       if$
  1271.       s nameptr "{vv{ } }{ll{ }}{  ff{ }}{  jj{ }}" format.name$ 't :=
  1272.       nameptr numnames = t "others" = and
  1273.         { "et~al." * }
  1274.         { t sortify * }
  1275.       if$
  1276.       nameptr #1 + 'nameptr :=
  1277.       namesleft #1 - 'namesleft :=
  1278.     }
  1279.   while$
  1280. }
  1281.  
  1282. FUNCTION {sort.format.title}
  1283. { 't :=
  1284.   "A " #2
  1285.     "An " #3
  1286.       "The " #4 t chop.word
  1287.     chop.word
  1288.   chop.word
  1289.   sortify
  1290.   #1 global.max$ substring$
  1291. }
  1292.  
  1293. FUNCTION {author.sort}
  1294. { author empty$
  1295.     { key empty$
  1296.         { "to sort, need author or key in " cite$ * warning$
  1297.           ""
  1298.         }
  1299.         { key sortify }
  1300.       if$
  1301.     }
  1302.     { author sort.format.names }
  1303.   if$
  1304. }
  1305.  
  1306. FUNCTION {author.editor.sort}
  1307. { author empty$
  1308.     { editor empty$
  1309.         { key empty$
  1310.             { "to sort, need author, editor, or key in " cite$ * warning$
  1311.               ""
  1312.             }
  1313.             { key sortify }
  1314.           if$
  1315.         }
  1316.         { editor sort.format.names }
  1317.       if$
  1318.     }
  1319.     { author sort.format.names }
  1320.   if$
  1321. }
  1322.  
  1323. FUNCTION {author.organization.sort}
  1324. { author empty$
  1325.     { organization empty$
  1326.         { key empty$
  1327.             { "to sort, need author, organization, or key in " cite$ * warning$
  1328.               ""
  1329.             }
  1330.             { key sortify }
  1331.           if$
  1332.         }
  1333.         { "The " #4 organization chop.word sortify }
  1334.       if$
  1335.     }
  1336.     { author sort.format.names }
  1337.   if$
  1338. }
  1339.  
  1340. FUNCTION {editor.organization.sort}
  1341. { editor empty$
  1342.     { organization empty$
  1343.         { key empty$
  1344.             { "to sort, need editor, organization, or key in " cite$ * warning$
  1345.               ""
  1346.             }
  1347.             { key sortify }
  1348.           if$
  1349.         }
  1350.         { "The " #4 organization chop.word sortify }
  1351.       if$
  1352.     }
  1353.     { editor sort.format.names }
  1354.   if$
  1355. }
  1356.  
  1357. FUNCTION {presort}
  1358. { sort.label
  1359.   calc.label
  1360.   "    "
  1361.   *
  1362.   type$ "book" =
  1363.   type$ "inbook" =
  1364.   or
  1365.     'author.editor.sort
  1366.     { type$ "proceedings" =
  1367.         'editor.organization.sort
  1368.         { type$ "manual" =
  1369.             'author.organization.sort
  1370.             'author.sort
  1371.           if$
  1372.         }
  1373.       if$
  1374.     }
  1375.   if$
  1376.   *
  1377.   "    "
  1378.   *
  1379.   year field.or.null sortify
  1380.   *
  1381.   "    "
  1382.   *
  1383.   title field.or.null
  1384.   sort.format.title
  1385.   *
  1386.   #1 entry.max$ substring$
  1387.   'sort.key$ :=
  1388. }
  1389.  
  1390. ITERATE {presort}
  1391.  
  1392. SORT
  1393.  
  1394. STRINGS { last.sort.label next.extra }
  1395.  
  1396. INTEGERS { last.extra.num }
  1397.  
  1398. FUNCTION {forward.pass}
  1399. { last.sort.label sort.label =
  1400.     { last.extra.num #1 + 'last.extra.num :=
  1401.       last.extra.num int.to.chr$ 'extra.label :=
  1402.     }
  1403.     { "a" chr.to.int$ 'last.extra.num :=
  1404.       "" 'extra.label :=
  1405.       sort.label 'last.sort.label :=
  1406.     }
  1407.   if$
  1408. }
  1409.  
  1410. FUNCTION {reverse.pass}
  1411. { next.extra "b" =
  1412.     { "a" 'extra.label := }
  1413.     'skip$
  1414.   if$
  1415.   label extra.label * "}" * 'label :=
  1416.   extra.label 'next.extra :=
  1417. }
  1418.  
  1419. ITERATE {forward.pass}
  1420.  
  1421. REVERSE {reverse.pass}
  1422.  
  1423. FUNCTION {begin.bib}
  1424. { preamble$ empty$
  1425.     'skip$
  1426.     { preamble$ write$ newline$ }
  1427.   if$
  1428.   "\begin{thebibliography}{}"  write$ newline$
  1429. }
  1430.  
  1431. EXECUTE {begin.bib}
  1432.  
  1433. EXECUTE {init.state.consts}
  1434.  
  1435. ITERATE {call.type$}
  1436.  
  1437. FUNCTION {end.bib}
  1438. { newline$
  1439.   "\end{thebibliography}" write$ newline$
  1440. }
  1441.  
  1442. EXECUTE {end.bib}
  1443.  
  1444.  
  1445.  
  1446.  
  1447.